<template>
	<div>
		<div class="g-doc">
			<header>
				<span>车商</span>
			</header>
			<!-- 选择框 -->
			<div class="search_all" style="display: none;">
				<span>所有人...</span>
				<i class="rfloat"></i>
				<ul class="person_list">
					<li id="45">二傻子哟</li>
					<li id="46">外勤测试员001</li>
					<li id="53">可跌</li>
				</ul>
			</div>
			<div class="select_box">
				<div class="select_top">
					<div class="select_type">
						<span>类型</span>
						<div class="rfloat"><span>全部</span><i class="rfloat to_bot"></i></div>
						<ul class="type_list">
							<li><span>全部</span></li>
							<li><span>直营店</span><i class="rfloat zhiying"></i></li>
							<li><span>加盟店</span><i class="rfloat jiameng"></i></li>
							<li><span>经销商</span><i class="rfloat jingxiaoshang"></i></li>
						</ul>
					</div>
					<div class="select_status">
						<span>状态</span>
						<div class="rfloat"><span>正常</span><i class="rfloat to_bot"></i></div>
						<ul class="status_list">
							<li>正常</li>
							<li>禁用</li>
						</ul>
					</div>
				</div>
				<div class="select_bot">
					<div class="select_company clearfix">
						<span class=""><i class="inputs">公司名</i><i class="company_bot"></i></span>
						<ul class="company_list">
							<li>公司名</li>
							<li>手机号</li>
							<li>联系人</li>
						</ul>
						<input type="text" placeholder="点击输入公司名" name="input_name" class="">
					</div>
					<div class="select_search">
						<i></i>
						<span>搜索</span>
					</div>
				</div>
			</div>
			<!-- 车商列表 -->
			<ul class="car_list">	
			<li class="jia_M" v-for="item in businlist" >
			<router-link  :to="{path:'/busin_detail/item.id',name:'busin_detail',params:{'id':item.id}}" style="display:block;">
					<h3>{{item.type}}</h3><input type="hidden" name="type" value="11">
					<div class="info">
						<div class="title">联系人：</div>
						<div class="msg">{{item.contact}}</div>
					</div>
					<div class="info">
						<div class="title">电话：</div>
						<div class="phone">
							<a class="phone_num" href="tel:item.mobile">{{item.mobile}}</a>
						</div>
					</div>
					<div class="info">
						<div class="title">公司名称：</div>
						<div class="company_name">{{item.company_name}}</div>
					</div>
					<div class="info">
						<div class="title">地址：</div>
						<div class="company_name">{{item.address}}</div>
					</div>
					<div class="info">
						<div class="title">状态:</div>
						<div class="status">{{item.status}}</div>
					</div>
					<hr class="yellow_hr">
					<p class="num">{{item.order_sn}}</p>
				</router-link>
				</li>
			</ul>
			<footer>
				<div class="footer_bar clearfix">
					<router-link to="/" class="home"></router-link>
					<router-link to="/order_list" class="dingdan"></router-link>
					<router-link to="/busin_list" class="cheshangs"></router-link>
					<router-link to="/me" class="geren"></router-link>
					<!--<a href="./car_dealer.html" class="cheshang"></a>-->
					<!--<a href="./user.html " class="geren"></a>-->
				</div>
			</footer>
		</div>
		<!--loadding-->
		<div class="loading" :class="{loading_show:l_show}">
			<div class="loading_box">
				<img src="/static/img/0.gif" alt="loading">
			</div></div>
		</div>
	</div>
</template>

<script>
	import sha1 from '../../static/js/sha/sha1'
	import axios from 'axios'

	var Mock = require("mockjs");
	var data = Mock.mock('busin_list', {
		"code": 200,
		"data": [{
				"id": 1,
				"address": 2545546,
				"addtime": "2018-03-03 12:29",
				"mobile": "18818122815",
				"order_sn": "B0102018030312196858",
				"company_name": "广州比比车汽车贸易有限公司",
				"status": "1",
				"contact": "nidaye",
				"type":10
			},
			{
				"id": 2,
				"address": "信義會館",
				"addtime": "2018-04-03 12:29",
				"mobile": "15618122815",
				"order_sn": "C0102018030312196858",
				"company_name": "广州比比车火车贸易有限公司",
				"status": "1",
				"contact": "heheehe",
				"type":11
			},
			{
				"id": 3,
				"address": "信義會館8號樓",
				"addtime": "2018-02-03 12:29",
				"mobile": "15218122896",
				"order_sn": "A0102018030312196858",
				"company_name": "广州百分之三火车贸易有限公司",
				"status": "11",
				"contact": "hahaha",
				"type":12
			},

		],
		"message": "成功"
	})

	export default {
		name: "busin_list",
		data() {
			return {
				busintype:"",
				businlist: [],
				l_show:true
			}
		},
		methods: {
			c_title(title) {
				document.title = title;
				return this;
			},
			is_Login(){
			//检查是否登录
			var token=window.localStorage.getItem("token");
			if(!token){
			this.$router.push({
			name:"login",path: '/login'
	});
			}else{
				return false;
			}
			return this;
		},
			getbusinList() {
			var that = this;
			axios.get("busin_list").then(function(res) {
	console.log(res);
	var data = res.data;
	if(data.code == 200) {
		console.log(123);
		that.businlist = data.data;
		that.l_show = false;
		for(var i = 0; i < data.data.length; i++) {
			if(data.data[i].type == "10") {
				data.data[i].type = "加盟店";
			} else if(data.type == "11") {
				data.data[i].type = "直營店";
			} else {
				data.data[i].type = "經銷商";
			}
			if(data.data[i].status == "1") {
				data.data[i].status = "正常";
			}else {
				data.data[i].status = "禁用";
			}
		}
	}
})
return this;
}
},
mounted() {
		this.c_title("商家列表").getbusinList().is_Login();
			//			this.c_title("商家列表");
		}
	}
</script>

<style scoped>
	@import url("../../static/css/car_dealer.css");
</style>